<nav-bar-panel></nav-bar-panel>
<div class="content container">
    <div ng-show="currentPage === 'list'">
        <div>
            <button class="btn btn-default" ng-click="toAddUser()">添加用户</button>
        </div>
        <div class="list-group shop-list-group common-list-group">
            <a ng-click="toManageUser(user)" class="list-group-item shop-list-item common-list-item"
               ng-repeat="user in users">
                <span class="shop-name name">{{user.username}}</span>
            </a>
        </div>
        <div class="m-pager">
            <button class="glyphicon glyphicon-triangle-left"
                    ng-click="usersPage = usersPage - 1; loadUsers()">
            </button>
            <span>第{{usersPage}}/{{1 + parseInt((usersTotal - 1) / pageSize)}}页</span>
            <button class="glyphicon glyphicon-triangle-right"
                    ng-click="usersPage = usersPage + 1; loadUsers()">
            </button>
        </div>
    </div>
    <div ng-show="currentPage==='manage-user'">
        <h4>用户: {{currentUser.displayName}} <span ng-if="currentUser.wechatUid">(微信用户)</span></h4>
        <h4>用户角色</h4>

        <div>
            <label ng-repeat="role in allRoles">
                <input type="checkbox" ng-model="role.checked" ng-click="toggleUserRole(currentUser, role)"/>
                {{role.displayName}}
            </label>
        </div>
    </div>
    <div ng-show="currentPage==='create'">
        <form>
            <div class="form-group">
                <label>用户名:</label>
                <input type="text" class="form-control" ng-model="username" placeholder="用户名">
            </div>
            <div class="form-group">
                <label>密码:</label>
                <input type="password" class="form-control" ng-model="password" placeholder="密码">
            </div>
            <div class="form-group">
                <label>是否商家:</label>
                <input type="checkbox" ng-model="isShopOwner"/>
            </div>
            <button type="button" class="btn btn-default" ng-click="addUser(username, password, isShopOwner)">添加用户
            </button>
        </form>
    </div>
</div>
<footer-bar-panel></footer-bar-panel>